package 动态规划;

/**
 * @ClassName _62不同路径
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2021/12/30 19:15
 * Version 1.0
 **/
public class _62不同路径 {
    public int uniquePaths(int m, int n) {
        int[][] a = new int[m][n];
        for(int i = 0; i < n; i++){
            a[0][i] = 1;
        }
        for(int i = 0; i < m; i++){
            a[i][0] = 1;
        }
        for(int i = 1; i < n; i++){
            for(int j = 1; j < m; j++){
                a[j][i] = a[j][i - 1] + a[j - 1][i];
            }
        }
        return a[m - 1][n - 1];
    }
}
